package com.appology.chuck;

import java.util.List;

import com.google.appengine.api.datastore.DatastoreService;
import com.google.appengine.api.datastore.DatastoreServiceFactory;
import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.FetchOptions;
import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;
import com.google.appengine.api.datastore.Query;

public class ChuckUser {
	private String mGoogleId;
	private String mBuzzId;
	private String mDisplayName;
	
	public ChuckUser(){
		mGoogleId = null;
		mBuzzId = null;
		mDisplayName = null;
	}
	public ChuckUser(String googleId, String buzzId, String displayName){
		mGoogleId = googleId;
		mBuzzId = buzzId;
		mDisplayName = displayName;
	}
	
	public Key save(){
	    DatastoreService datastore =
			DatastoreServiceFactory.getDatastoreService();
//	    Key userKey = KeyFactory.createKey("ChuckUser", mGoogleId);
		Entity user = new Entity("ChuckUser", mGoogleId);
		user.setProperty("googleId", mGoogleId);
		user.setProperty("buzzId", mBuzzId);
		user.setProperty("displayName", mDisplayName);
//	    //Use an aId so that we can guarantee that the id will 
//	    //fall into our random number generator
//	    //ID - is auto-incremented therefore can be problematic
//		datastore.put
		return datastore.put(user);
	}
	


	public String getGoogleId() {
		return mGoogleId;
	}

	public void setGoogleId(String googleId) {
		this.mGoogleId = googleId;
	}

	public String getBuzzId() {
		return mBuzzId;
	}

	public void setBuzzId(String BuzzId) {
		this.mBuzzId = BuzzId;
	}

	public String getDisplayName() {
		return mDisplayName;
	}

	public void setDisplayName(String DisplayName) {
		this.mDisplayName = DisplayName;
	}
	
}
